package com.san.test;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.san.dissertation.bpm.model.ProcessInstance;

public class Client {
	
	private static BusinessService service;
	
	public static void main(String[] args) {
		
		ClassPathXmlApplicationContext cxt= new ClassPathXmlApplicationContext("bpmContext.xml");

		 service= (BusinessService)cxt.getBean("businessService");
		File file = new File(
				"D:\\FinalDissertation\\ProcessLauncher\\src\\main\\resources\\makercheckerRevised.bpmn20.xml");
		try {
			InputStream stream = new FileInputStream(file);

			service.getParseProcess().deploy();
			service.initiateProcess(stream, file.getName());
			
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		//getProcessInstancesforProcess
		System.out.println(service.getProcessInstanceDetails("sankarMakerChecker").size());
		

	}


}
